package com.jgqBook.component;

import com.jgqBook.util.PathUtils;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.File;
import java.io.IOException;

public class AboutMe extends Box {

    JFrame jf = null;
    final int WIDTH = 1200;
    final int HEIGHT = 600;

    public AboutMe(JFrame jf) throws IOException {
        // 垂直布局
        super(BoxLayout.Y_AXIS);
        //组装视图
        this.jf = jf;
        // 设置背景图片
        BackGroundPanel bgPanel = new BackGroundPanel(ImageIO.read(new File(PathUtils.getRealPath("aboutme.png"))));
        bgPanel.setBounds(0, 0, WIDTH, HEIGHT);
        // 垂直布局
        Box vBox = Box.createVerticalBox();
        Box zBox = Box.createHorizontalBox();
        JLabel zLabel = new JLabel("致    谢");
        zLabel.setFont(new java.awt.Font("等线", 1, 30));

        zBox.add(zLabel);
        Box authorBox = Box.createHorizontalBox();
        JLabel authorLabel = new JLabel("作者：");
        JTextField authorField = new JTextField(15);

        authorLabel.setFont(new java.awt.Font("等线", 1, 16));
        authorField.setText("JuJuBao");
        authorField.setBorder(null);
        authorField.setOpaque(false);
        authorField.setEditable(false);

        authorBox.add(authorLabel);
        authorBox.add(authorField);


        Box thankBox = Box.createVerticalBox();
        Box biliBox = Box.createHorizontalBox();
        JTextField biliField = new JTextField();
        JTextField urlBiliField = new JTextField();

        biliField.setText("项目灵感");
        urlBiliField.setText("黑马图形化编程");

        biliField.setFont(new java.awt.Font("等线", 1, 15));
        biliField.setBorder(null);
        biliField.setOpaque(false);
        biliField.setEditable(false);
        urlBiliField.setFont(new java.awt.Font("等线", 1, 15));
        urlBiliField.setBorder(null);
        urlBiliField.setOpaque(false);
        urlBiliField.setEditable(false);

        biliBox.add(biliField);
        biliBox.add(Box.createHorizontalStrut(15));
        biliBox.add(urlBiliField);
        thankBox.add(biliBox);
        thankBox.add(Box.createVerticalStrut(20));

        vBox.add(zLabel);   // 添加致谢二字
        vBox.add(Box.createVerticalStrut(40));

        vBox.add(thankBox);

        bgPanel.add(vBox);
        this.add(bgPanel);
    }
}
